<html>
  <head>
    <script>
      function appendResults(text) {
        var results = document.getElementById('results');
        results.appendChild(document.createElement('P'));
        results.appendChild(document.createTextNode(text));
      }

      function makeRequest() {
      	alert("Hello! makeRequest");
        var request = gapi.client.urlshortener.url.get({
          'shortUrl': 'http://goo.gl/fbsS'
        });
        request.execute(function(response) {
          appendResults(response.longUrl);
        });
      }

      function load() {
      	alert("Hello!");
        gapi.client.setApiKey('AIzaSyA3Ye0Vd1TsZcyGJAaEKLbGS3A_U2S_iv4');
        gapi.client.load('urlshortener', 'v1', makeRequest);
      }
    </script>
    <script src="https://apis.google.com/js/client.js?onload=load"></script>
  </head>
  <body>
    <div id="results"></div>
  </body>
</html>